package cn.edu.scau.cmi.liujiaming.chapter05;

public class Triangle {
	double sideA,sideB,sideC;
	boolean isTriangle;
	Triangle(double a,double b,double c){
		sideA=a;
		sideB=b;
		sideC=c;
		if((a+b>c)&&(b+c>a)&&(a+c>b)) {
			isTriangle=true;
		}
		else {
			isTriangle=false;
		}
	}
	void computerArea() {
		if(isTriangle) {
			double p=(sideA+sideB+sideC)/2.0;
			double area=Math.sqrt(p*(p-sideA)*(p-sideB)*(p-sideC));
			System.out.println("是一个三角形，面积为："+area);
		}
		else {
			System.out.println("不是三角形，面积不能计算");
		}
	}
	void setSide(double a,double b,double c) {
		sideA=a;
		sideB=b;
		sideC=c;
		if((a+b>c)&&(b+c>a)&&(a+c>b)) {
			isTriangle=true;
		}
		else {
			isTriangle=false;
		}
	}

}
